inline
Logger *Logger::next (void)
{
	return this->next_node_;
}
inline
void Logger::next (Logger *nl)
{
	this->next_node_ = nl;
}
inline
int Logger::log_level (void)
{
	return this->log_level_;
}
inline
void Logger::log_level (int lv)
{
	this->log_level_ = lv;
}
inline
int Logger::parent_llevel (void)
{
	return this->parent_llevel_;
}
inline
void Logger::parent_llevel (int lv)
{
	this->parent_llevel_ = lv;
}
inline
bool Logger::shutdown (void)
{
	return NDK_BIT_ENABLED (this->log_level_, LL_SHUTDOWN) ||
		NDK_BIT_ENABLED (this->parent_llevel_, LL_SHUTDOWN);
}
inline
void Logger::shutdown (bool switch_val)
{
	if (switch_val) // shutdown
		NDK_SET_BITS (this->log_level_ , LL_SHUTDOWN);
	else
		NDK_CLR_BITS (this->log_level_ , LL_SHUTDOWN);
}
inline
int Logger::log (int ll, const char *format, ...)
{
	/**
	 * For optimising, we can call 
	 * 	if (log->shutdown () || 
	 * 		!log->enable_for (ll))
	 * 	return 0;
	 * 	here, but can't call LogManager::update_config(), can't
	 * 	load the new config in runing time.
	 */
	//
	va_list va;
	va_start (va, format);
	int ret = this->log_manager_->log (this, ll, format, va);
	va_end (va);
	return ret;
}
#define SHORT_CODE(LL) va_list va; \
	va_start (va, format); \
	int ret = this->log_manager_->log (this, LL, format, va); \
	va_end (va); \
	return ret

inline
int Logger::trace (const char *format, ...) { SHORT_CODE (LL_TRACE); }
inline
int Logger::debug (const char *format, ...) { SHORT_CODE (LL_DEBUG); }
inline
int Logger::warning (const char *format, ...) { SHORT_CODE (LL_WNING); }
inline
int Logger::error (const char *format, ...) { SHORT_CODE (LL_ERROR); }
inline
int Logger::rinfo (const char *format, ...) { SHORT_CODE (LL_RINFO); }
inline
int Logger::fatal (const char *format, ...) { SHORT_CODE (LL_FATAL); }

inline
const char *Logger::module_name (void)
{
	return this->module_name_;
}
inline
void Logger::module_name (const char *name)
{
	if (name == 0) return ;
	strncpy (this->module_name_, name, MAX_MODULE_NAME_LEN);
}
inline
bool Logger::enable_for (int ll)
{
	return NDK_BIT_ENABLED (this->log_level_, ll) || 
		NDK_BIT_ENABLED (this->parent_llevel_, ll);
}
inline
void MethodTrace::init (void)
{
	memset (this->spaces_, ' ', sizeof (this->spaces_));
	this->spaces_[sizeof (this->spaces_) - 1] = '\0';
}
